var Reservation = {
		checkFlg : 1,
		init : function(){},
		checkVipCard : function(){
			var encorecard = 0;
			var creditcard = 0;
			if(vip == '1' && getCookie("vip") == '0'){
				Reservation.popHtml(1, creditcard);
				return false;
			}
			if(n_encorecard == '1' && getCookie("encorecard") == '0'){
				encorecard = 1;
			}
			if(n_creditcard == '1' && getCookie("creditcard") == '0'){
				creditcard = 1;
			}
			if(encorecard == 0 && creditcard == 0){
				Reservation.tableSubmit();
			}else{
				Reservation.popHtml(encorecard, creditcard);
				return false;
			}
			
		},
		tableSubmit : function(){
			if(confirm("are you sure to reserve?")){
				var tids = '';
				$(".seatList .selected").each(function(){
					tids += $(this).attr("id") + ",";
				});
				var number = $("#number").val();
				$.ajax({
					type : "post",
					url : "/index.php?r=order/gen",
					data: {eid : eid, tids : tids.substring(0, tids.length-1), number : number},
					success : function(data){
						if(data.indexOf("success") != -1){
							var suc_tempArr = data.split(':');
							$("#success").text(suc_tempArr[1]);
							$("#mask").show();
							$("#popWin").show();
							timeout = setTimeout(function(){
								location.reload();
							}, 3000);
						}else{
							alert(data)
							return false;
						}
					}
				});
			}
		},
		popHtml : function(encorecard, creditcard){
			var html = '';
			if(encorecard == 1){
				html += '<dt>encore card</dt><dd><input name="encorecard" id="encorecard" type="text" class="txtInput"></dd>';
			}
			if(creditcard == 1){
				html += '<dt>credit card</dt> <dd><input name="creditcard" id="creditcard" type="text" class="txtInput"></dd>';
			}
			$("#dl_card").append(html);
			$("#mask").show();
			$("#popWinA").show();
		}
	};


